<?php

/*
	[BuyPg] (C) 2010-2011 Buypg
	$Id: NbSiteModel.class.php 2011-10-11 13:11:17 wufujun $
 */
if (!defined('THINK_PATH')) {
	exit('Access Denied');
}

class NbSiteModel extends CommonModel{
	public $_validate	=	array(
		array('site_name','require','网站名称必须'),
		array('class_id','require','所属分类必须'),
	);
	
	//自动填充
	protected $_auto = array(
		array('site_key' , 'getsitekey' , 3 , 'callback'),
		array('site_link' , 'urlencode' , 3 , 'function'),
	);
	
	//生成key
	protected function getsitekey(){
		if($_POST['site_link']){
			$arrLink = parse_url($_POST['site_link']);
			$sitekey = sha1($arrLink['host']);
		}
		return $sitekey;
	}
}
?>